<div ng-controller="AdminPreopenCtrl as vm">
    <section class="content-header">
        <!-- Content Header (Page header) -->
        Preopen Summary and Report Export
        <!-- <div class="pull-right">
                        <form class="form-inline">
                          <div class="form-group">
                            <select class="form-control" ng-options="div for div in years track by div" ng-model="vm.year" ng-change="vm.loadData()">
                      </select>
                          </div>
                          <div class="form-group">
                            <select class="form-control" ng-options="div for div in months track by div" ng-model="vm.month" ng-change="vm.loadData()">
                      </select>
                          </div>
                        
                       <a class="btn btn-primary">Export Region Summary</a>
                       <a class="btn btn-primary">Export Hotel Summary</a>
</form>
                      
                    </div> -->
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">Preopening Activities Completion Rate</h3>
                        <div class="pull-right">
                            <a class="btn btn-xs btn-danger" ng-href="/api/preopen/export/completion">Export Report</a>
                        </div>
                    </div>
                    <div class="box-body table-responsive no-padding">
                        <table ng-table="vm.tableParams1" class="table table-hover table-bordered table-condensed" show-filter="true">
                            <tr ng-repeat="ret in $data">
                                <td title="'Hotel Name'" filter="{ name: 'text'}" sortable="'name'">
                                    {{ret.hotelName}}</td>
                                <td title="'Updated Date'" filter="{ 'ret.updatedDate': 'text'}" sortable="'ret.updatedDate'">
                                    {{ret.updatedDate|date}}</td>
                                <td title="'HR'" filter="{ 'brand': 'text'}" sortable="'brand'">
                                    {{ret.hrPercentage*100 |percentage}}</td>
                                <td title="'Training'" filter="{ 'brand': 'text'}" sortable="'brand'">
                                    {{ret.trPercentage*100 |percentage}}</td>
                                <td title="'Total'" filter="{ 'brand': 'text'}" sortable="'brand'">
                                    {{ret.totalPercentage*100 |percentage}}</td>
                            </tr>
                            <tr>
                                <th>Total</th>
                                <th></th>
                                <th>{{vm.total.complete.hr*100 |percentage}}</th>
                                <th>{{vm.total.complete.tr*100 |percentage}}</th>
                                <th>{{vm.total.complete.total*100 |percentage}}</th>
                            </tr>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">YTD total employees recruited</h3>
                        <div class="pull-right">
                            <a class="btn btn-xs btn-danger" ng-href="/api/preopen/export/ytd">Export Report</a>
                        </div>
                    </div>
                    <div class="box-body table-responsive no-padding">
                        <table ng-table="vm.tableParams2" class="table table-hover table-bordered table-condensed" show-filter="true">
                            <tr ng-repeat="ret in $data">
                                <td title="'Hotel Name'" filter="{ name: 'text'}" sortable="'name'">
                                    {{ret.hotelName}}</td>
                                <td title="'Updated Date'" filter="{ 'ret.updateDate': 'text'}" sortable="'ret.updateDate'">
                                    {{ret.updateDate|date}}</td>
                                <td title="'No. of staff on board as at this month'" filter="{ 'brand': 'text'}" sortable="'brand'">
                                    {{ret.staffNo}}</td>
                            </tr>
                            <tr>
                                <th>Total</th>
                                <th></th>
                                <th>{{vm.totalStaffNo}}</th>
                            </tr>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">On-boarding percentage for the key positions</h3>
                        <div class="pull-right">
                            <a class="btn btn-xs btn-danger" ng-href="/api/preopen/export/recruit">Export Report</a>
                        </div>
                    </div>
                    <div class="box-body table-responsive no-padding">
                        <table ng-table="vm.tableParams6" class="table table-hover table-bordered table-condensed" show-filter="true">
                            <tr ng-repeat="ret in $data">
                                <td title="'Hotel Name'" filter="{ hotelName: 'text'}" sortable="'hotelName'">
                                    {{ret.hotelName}}</td>
                                <td title="'Current Month'" filter="{ 'vm.month': 'text'}" sortable="'vm.month'">
                                    {{vm.month}}</td>
                                    <td title="'Updated Date'" filter="{ 'ret.lastUpdateTime': 'text'}" sortable="'ret.lastUpdateTime'">
                                    {{ret.lastUpdateTime|date}}</td>
                                <td title="'Target Opening Date'" filter="{ 'targetOpendate': 'text'}" sortable="'targetOpendate'">
                                    {{ret.targetOpendate |date}}</td>
                                <td title="'GM'" ng-switch='ret.people[0].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[0],2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'HM/RM/EAM'" ng-switch='ret.people[1].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[1],2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'FC'" ng-switch='ret.people[2].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[2],2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'HRD'" ng-switch='ret.people[3].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[3], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Tng Mgr'" ng-switch='ret.people[4].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[4], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'DOSM'" ng-switch='ret.people[5].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[5], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Rev Mgr'" ng-switch='ret.people[6].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[6], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'DoFBev'" ng-switch='ret.people[7].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[7], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Exec Chef'" ng-switch='ret.people[8].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[8], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'DOE'" ng-switch='ret.people[9].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[9], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'IT Mgr'" ng-switch='ret.people[10].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[10], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'DOR'" ng-switch='ret.people[11].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[11], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'FO Mgr'" ng-switch='ret.people[12].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[12], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Exec HKP'" ng-switch='ret.people[13].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[13], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'CMD/DOC'" ng-switch='ret.people[14].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[14], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Marcom Mgr'" ng-switch='ret.people[15].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[15], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Security Mgr'" ng-switch='ret.people[16].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[16], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'Procurement Mgr'" ng-switch='ret.people[17].phase=="On-board"'>
                                    <div ng-switch-when="true">
                                        <a ng-click="vm.viewVacancyDetail(ret, ret.people[17], 2)">
                                        1
                                        </a></div>
                                    <div ng-switch-default>0
                                    </div>
                                </td>
                                <td title="'On-boarding Percentage'" >
                                   {{vm.getPercentage(ret.people)*100 | percentage}}
                                </td>
                            </tr>
                            <tr>
                                <th>Total</th>
                                <th></th>
                                <th></th>
                                <th></th>
                                <th>{{vm.total4.data[0].number}}</th>
                                <th>{{vm.total4.data[1].number}}</th>
                                <th>{{vm.total4.data[2].number}}</th>
                                <th>{{vm.total4.data[3].number}}</th>
                                <th>{{vm.total4.data[4].number}}</th>
                                <th>{{vm.total4.data[5].number}}</th>
                                <th>{{vm.total4.data[6].number}}</th>
                                <th>{{vm.total4.data[7].number}}</th>
                                <th>{{vm.total4.data[8].number}}</th>
                                <th>{{vm.total4.data[9].number}}</th>
                                <th>{{vm.total4.data[10].number}}</th>
                                <th>{{vm.total4.data[11].number}}</th>
                                <th>{{vm.total4.data[12].number}}</th>
                                <th>{{vm.total4.data[13].number}}</th>
                                <th>{{vm.total4.data[14].number}}</th>
                                <th>{{vm.total4.data[15].number}}</th>
                                <th>{{vm.total4.data[16].number}}</th>
                                <th>{{vm.total4.data[17].number}}</th>
                                <th>{{vm.getPercentageAll(vm.total4.data)*100 | percentage}}</th>
                            </tr>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">Individual Hotel Preopening Report</h3>
                        <div class="pull-right">
                        </div>
                    </div>
                    <div class="box-body table-responsive no-padding">
                        <table ng-table="vm.tableParams5" class="table table-hover table-bordered table-condensed" show-filter="true">
                            <tr ng-repeat="ret in $data">
                                <td title="'Holidex Code'" filter="{ code: 'text'}" sortable="'code'">
                                    {{ret.code}}</td>
                                <td title="'Region'" filter="{ 'region.name': 'text'}" sortable="'region.name'">
                                    {{ret.region.name}}</td>
                                <td title="'Cluster'" filter="{ 'cluster.name': 'text'}" sortable="'cluster.name'">
                                    {{ret.cluster.name}}</td>
                                <td title="'Hotel Name'" filter="{ name: 'text'}" sortable="'name'">
                                    {{ret.name}}</td>
                                <td title="'Brand'" filter="{ 'brand': 'text'}" sortable="'brand'">
                                    {{ret.brand}}</td>
                                <td title="'Export'">
                                    <a class="btn btn-xs btn-primary" ng-href="/api/preopen/export/task/{{ret.id}}">Activities Report</a>
                                    <a class="btn btn-xs btn-primary" ng-href="/api/preopen/export/people/{{ret.id}}">Recruiment Report</a>
                                    <a class="btn btn-xs btn-primary" ng-href="/api/preopen/target/export/{{ret.id}}">Target Review Report</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>
